package com.weilele.leisure.time.ui.dialog


import android.os.Bundle
import android.view.View
import com.google.android.exoplayer2.offline.Download
import com.weilele.base.library.BaseBindingDialog
import com.weilele.leisure.time.R
import com.weilele.leisure.time.databinding.DialogTransformingMediaBinding
import com.weilele.leisure.time.ui.holder.SingleTextHolder
import com.weilele.mvvm.adapter.refreshList


class TransformingMediaDialog : BaseBindingDialog<DialogTransformingMediaBinding>() {
    companion object {
        fun show(view: View, download: Download, title: String?) {
            TransformingMediaDialog().apply {
                media = download
                mediaTitle = title
            }
        }
    }

    private var media: Download? = null
    private var mediaTitle: String? = null

    override fun initUi(savedInstanceState: Bundle?) {
        super.initUi(savedInstanceState)
        val download = media
        if (download == null) {
            dismiss()
            return
        }
        mediaTitle?.let {
            mBinding.title.text =
                String.format(getString(R.string.transforming_media_title_hint, it))
        }
        mBinding.rcv.adapter = SingleTextHolder.toAdapter().apply {
            refreshList(
                mutableListOf(
                    "MP4"
                )
            )
        }
    }

    private fun startTransformingMedia(download: Download) {

    }
}